// pages/creativity-test/creativity-test.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    formDialogVisible: true,
    resDialogVisible: false,
    
    form: {
      name: '',
      school: 'x',
      classGrade: '',
      parentPhone: ''
    },
  },
  resDialogOpen () {
    this.setData({
      resDialogVisible: true
    })
  },
  formDialogOpen () {
    this.setData({
      formDialogVisible: true
    })
  },
  formDialogClose () {
    this.setData({
      formDialogVisible: false
    })
  },
  onClickGetScore () {
    let {data} = this
    // getScore({
    //   name: data.name,
    //   school: data.school,
    //   classGrade: data.classGrade,
    //   parentPhone: data.parentPhone
    // })
    this.setData({
      formDialogVisible: false
    })
    console.log(this.data.name)
  },
  onInputName ({detail}) {
    let {form} = this.data
    form.name = detail.value
    this.setData({
      form
    })
    console.log(form)
  },
  onInputSchool ({detail}) {
    let {form} = this.data
    form.school = detail.value
    this.setData({
      form
    })
    console.log(this.data.form)
  },
  onInputClassGrade ({detail}) {
    let {form} = this.data
    form.classGrade = detail.value
    this.setData({
      form
    })
  },
  onInputParentPhone ({detail}) {
    let {form} = this.data
    form.parentPhone = detail.value
    this.setData({
      form
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})